struct A {
    var a: Int;
}

struct B {
    var b: Int;
    var a: CArray[A];
}

var topLevelArray: CArray[A, 2] = [struct A {a: 1}, struct A {a: 2}];

function main() {
    var a: CArray[Int, 3] = empty;
    printf("%i\n", a[0]);
    printf("%i\n", a[1]);
    printf("%i\n", a[2]);

    var b: CArray[Int, 4];
    b = [4, 5, 6, 7];
    printf("%i\n", b[1]);
    printf("%i\n", b.length);

    var c: CArray[Int, 5] = [8, 9, 10, 11, 12];
    printf("%i\n", c[2]);
    printf("%i\n", c.length);

    printf("%i\n", ([1, 2, 3, 4, 5, 6]).length);

    var arrayPtr: Ptr[Int] = c;
    printf("%i\n", *arrayPtr);
    printf("%i\n", *(arrayPtr + 1));
    printf("%i\n", *(arrayPtr + 2));

    for i in c {
        printf("i: %i\n", i);
    }

    printf("0.a=%i 1.a=%i\n", topLevelArray[0].a, topLevelArray[1].a);
}
